home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / windob10.zip / WINDOBJS.DOC < prev    next >
Text File  |  1994-03-19  |  7KB  |  193 lines

  1.  
  2.     | Windobjs Documentation
  3.     | Version 1.0
  4.     | Copyright 1994, Jake Geller
  5.  
  6. Description :
  7.  
  8.     Windobjs is a unit dedicated to graphical windows.  It is easy to use and
  9. offers great flexibility (In my humble opinion).  Some features include
  10. moveable windows, sizeable windows, closeable windows, and controls within
  11. windows (that are limited to the window).  The windows only redraw where they
  12. need to redraw (through viewports!) so they are as fast as you can go with the
  13. BGI.  Perhaps, in the future, I will remove the BGI and write my own graphics
  14. routines.
  15.  
  16. BIG NOTE :
  17.  
  18.     As you can see, this documentation is rather obtuse.  I'm a programmer,
  19. not a document writer, and I wanted to get this out into the public quickly,
  20. so I haven't spent a great deal of time writing these.  If you have questions
  21. regarding this programming unit, or suggestions, or just plain complaints,
  22. please Email me at :
  23.  
  24.         Bgeller@moose.uvm.edu
  25.  
  26.      Or mail me at :
  27.  
  28.         Jake Geller
  29.         RR 1 Box 1376
  30.         Charlotte, VT 05445
  31.  
  32.     Also, this unit is shareware.  You may use it for personal use as long as
  33. you would like, but any commercial use (ie., you get money for a product which
  34. incorporates this unit) must be registered.  Registration costs a measly $15
  35. and entitles the user to complete source code for up to 2 more verions.
  36.  
  37. Disclaimer :
  38.  
  39.     The author, me, does not insure any of this program or what it does.  If
  40. your computer is fried because of this program, I'll be very surprised, but
  41. tough.  (There are no viruses in this object, you can run whatever virus
  42. checker's you want on it to verify that)
  43.  
  44. Using Windobjs in your program :
  45.  
  46.     The first step to creating a WindObjs program is to create a new main
  47. application.  Turbovision uses "TApplication," I use "PMain"... Creating a new
  48. application is easy :
  49.  
  50.     Program BareMinimum;
  51.     var
  52.       Main : PMain; {Main Application for insertion}
  53.     begin
  54.       New(Main, Init);
  55.       Main^.Done;
  56.     end.
  57.  
  58.     What does the above program do?  Well, nothing, actually, but you probably
  59. expected that.  It _does_ enter graphics mode and change the background color
  60. to 7, it initializes variables for the application that need to be
  61. intialized, and it initializes the mouse.  Then it returns you to textmode.
  62.  
  63.     The next step is to add some windows.  Windows are objects, too, and they
  64. have to be "Insert"ed in to the application so that the application will know
  65. they're there.  Then the application has to be run to handle events for
  66. windows.
  67.  
  68.     Program Lets_Add_A_Window;
  69.     var
  70.       Main : PMain;
  71.       Window : PView; {Here's our new window!}
  72.     Begin
  73.       New(Main, Init);
  74.       New(Window, Init(10,10,100,50,'Demo Window',TheFlags);
  75.       Main^.insert(Window);
  76.       Main^.Run;
  77.       Main^.Done;
  78.     end.
  79.  
  80.     A couple of new things here.  One is, we added a window.  The window is
  81. located at coordinates (10,10) and is 100 pixels wide and 50 pixels high.
  82. Its title is "Demo Window" and it has the default flags.  TheFlags is a
  83. variable of type ByteSet which is a set of flags cmSize, cmMove, cmClose,
  84. cmMax.  TheFlags starts out as having all of these flags set.  Or you can put
  85. in that area "cmSize+cmMax" to have it sizeable and maximizable.  The
  86. "Main^.Insert(Window)" inserts the window in to Main's list of objects.  It
  87. then checks for the mouse and handles any buttonpresses.
  88.  
  89.     Okay, so we can put in a window or two.  That's not going to help the
  90. application look its best.  So we add controls.  Controls have to be
  91. "init"ialized and "insert"ed just like windows.  They can be inserted either
  92. in to the application or a view.  If they're inserted in to the view, their
  93. coordinates are relative to the view's.  Here's an example of adding a
  94. "Button" control.
  95.  
  96.     Program Lets_Add_A_Window;
  97.     var
  98.       Main : PMain;
  99.       Window : PView;
  100.       Button : PButton; {Here's a button!}
  101.     Begin
  102.       New(Main, Init);
  103.       New(Window, Init(10,10,100,50,'Demo Window',TheFlags);
  104.       New(Button, Init(5,5,150,15,'Button',donothing));
  105.       Window^.Insert(Button);
  106.       Main^.insert(Window);
  107.       Main^.Run;
  108.       Main^.Done;
  109.     end.
  110.  
  111.     This adds a button named "Button" to the window "Window."  The button is
  112. labeled "Button" (centered in the button) and when you press it, the procedure
  113. "donothing" is run.  Donothing is a built in procedure, so if you want your
  114. button (or other control) to do absolutely nothing, put "donothing."  The button
  115. is at relative coordinates (5,5) and is 150 pixels wide and 15 pixels high.
  116. What does that mean on the screen?  It means that there is a window at (10,10)
  117. and at coordinates (15,35) there is the upper lefthand corner of a push
  118. button.  Why 35?  Why not 15?  Because there is a header on each window that
  119. is 20 pixels high.
  120.  
  121.   Another type of control is a "PIcon" which, as it looks, is an Icon control.
  122. The icon control has the same "init" except that there is an extra parameter
  123. at the beginning called "Filename"... Filename is the name of the iconfile.
  124. An iconfile consists of a BitMaped image (gotten with GetImage) blockwritten
  125. to a file.  Icons have to inserted just like Buttons.  Unlike buttons, icons
  126. can be moved around within the view (they are restricted to the view or
  127. application boundaries, however).  Icons, once they are pressed, if they
  128. aren't moved at all, invert.  The colors become reverse of what they were.  If
  129. you press the icon again without moving, whatever their procedure is will be
  130. executed.
  131.  
  132.     The procedures that are run by controls must be declared as FAR:
  133.  
  134.         Procedure ButtonWasPressed; far;
  135.  
  136.     or an error will be generated and the program will halt.
  137.  
  138. Appendix A : Objects
  139.  
  140.     PButton
  141.     PCheckBox
  142.     PIcon
  143.     PMain
  144.     PText
  145.     PView
  146.  
  147.   PButton - Control
  148.  
  149.     PButton.Init(X1, Y1, Width, Height: Integer; Text : String; Proc2Do :
  150.                  Procedure);
  151.  
  152.     PButton adds a push button to a window or the main application.
  153.  
  154.   PCheckBox - Control
  155.  
  156.     PCheckBox.Init(X, Y, Width, Height : Integer; Text : String);
  157.  
  158.     Adds a checkbox to your document.  Can be "read" with the "SELECTED"
  159.     attribute.
  160.  
  161.   PIcon - Control
  162.  
  163.     PIcon.Init(FileName : String; X1, Y1, Width, Height: Integer; Text :
  164.                String; Proc2Do : Procedure);
  165.  
  166.     PIcon adds a moveable icon to a window or the main application.
  167.  
  168.   PMain - Application
  169.  
  170.     PMain.Init();
  171.  
  172.     Creates an application.  Necessary for Windows execution!!!!!!!
  173.  
  174.   PScrollBar - Control
  175.  
  176.     PScrollBar.Init(X1, Y1, Width, Height : Integer);
  177.  
  178.     PIcon adds a scrollbar to a view.
  179.  
  180.   PText - Control
  181.  
  182.     PText.Init(X1, Y1, Width, Height : Integer; Text : String; Proced :
  183.                Procedure);
  184.  
  185.     Adds a static text box to a view or the main application.
  186.  
  187.   PView - View
  188.  
  189.     PView.Init(X1, Y1, Width, Height : Integer; Title : String; Flags :
  190.                FlagType);
  191.  
  192.     Adds a new window to the application.
  193.